﻿@using Xproject.Util;
@using Model.Util.DTO;
@using Model.Util;
@{
    Layout = null;
    string Domain = CommonHelper.GetAppSettings("Domin");
}
@model AttributeListModel
<!DOCTYPE html>

<html>

<head>
    <meta name="viewport" content="width=device-width" />
    <title>属性分组列表</title>

    <link href="~/Content/categoryCss/site.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-1.10.2.js"></script>
    <script src="~/Scripts/layer/layer.js"></script>
    <script type="text/javascript" src="/admin_mall/scripts/showlist.js"></script>
    <script type="text/javascript">
        function DelAttr(obj, attrId) {
            layer.confirm('确认删除此属性？', {
                btn: ['确认', '取消'] //按钮
            }, function () {

                    $.ajax({
                         url: "@(Domain+ "/Category/DelAttribute")",
                    type: 'post',
                    cache: 'false',
                    async: 'false',
                    data: { attrId: attrId },
                    success: function (data) {
                        if (data.Success == true) {
                            layer.alert('删除成功', { icon: 1, skin: 'layer-ext-moon', time: 2000 });
                          
                            $(obj).parent().parent().remove();
                        } else {
                            layer.alert('删除失败', { icon: 1, skin: 'layer-ext-moon', time: 2000 });
                        }
                           },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {

                        }
                    });


                }, function () {
                    layer.closeAll('dialog');
                }
               );

        }
    </script>

    <style type="text/css">
        /*分类树*/
        #categoryTree {
            padding-left: 15px;
            margin-top: 15px;
            text-align: left;
        }

            #categoryTree thead th {
                background: #dbeffa;
                font-weight: normal;
                cursor: pointer;
                padding: 4px 0;
                padding-left: 10px;
            }

            #categoryTree table tbody th {
                text-align: left;
                font-weight: normal;
            }

                #categoryTree table tbody th span {
                    display: inline-block;
                    width: 16px;
                    height: 16px;
                    cursor: pointer;
                }

                    #categoryTree table tbody th span.openthis {
                        background: url('../../Content/images/tree_open.gif') no-repeat center center;
                    }

                    #categoryTree table tbody th span.closethis {
                        background: url('../../Content/images/tree_close.gif') no-repeat center center;
                    }

            #categoryTree tbody td, #categoryTree tbody th {
                border-bottom: 1px solid #ececec;
                padding: 4px 0;
                padding-left: 10px;
            }

            #categoryTree table tbody tr {
                display: table-row;
            }

                #categoryTree table tbody tr.tree1 {
                    display: table-row;
                }

        .clear {
            clear: both;
        }

        .left {
            float: left;
        }

        .right {
            float: right;
        }
        /*右侧Right*/
        .rightH1 {
            border-bottom: 2px solid #93aebf;
            font-size: 12px;
            color: #135275;
            height: 30px;
            line-height: 30px;
            position: relative;
            margin-left: 15px;
        }

            .rightH1 div {
                font-size: 14px;
                position: absolute;
                top: 3px;
                *top: 3px;
                _top: 10px;
                right: 0px;
                _right: 5px;
            }

            .rightH1 img {
                width: 32px;
                height: 24px;
            }
    </style>
</head>
<body>


    <h1 class="rightH1">
        属性管理 &gt;&gt; 属性列表
        <div class="right">
            <a href="@Url.Action("CategoryList")" class="menuBT"><img src="../../content/images/goback.jpg" />返回分类</a>
            <a href="@Url.Action("Addattribute", new { cateId = Model.CateId })" class="menuBT"><img src="../../content/images/add.jpg" />添加属性</a>
            <div class="clear"></div>
        </div>
        <div class="clear"></div>
    </h1>

  
        <input type="hidden" value="@Model.CateId" id="CateId" name="CateId" />
        <input type="hidden" value="@Model.SortColumn" id="sortColumn" name="sortColumn" />
        <input type="hidden" value="@Model.SortDirection" id="sortDirection" name="sortDirection" />
        <div class="table_top"></div>
        <div class="dataList">
            <table width="100%">
                <thead>
                    <tr>
                        <th width="10" align="center"></th>
                        <th width="74" align="left" name="sortTitle" column="attrid" direction="DESC">编号</th>
                        <th align="left" name="sortTitle" column="name" direction="DESC">属性名称</th>
                        <th width="200" align="left" name="sortTitle" column="attrgroupid" direction="DESC">属性分组</th>
                        <th width="100" align="left" name="sortTitle" column="showtype" direction="DESC">展示类型</th>
                        <th width="100" align="left" name="sortTitle" column="isfilter" direction="DESC">筛选属性</th>
                        <th width="100" align="left" name="sortTitle" column="displayorder" direction="ASC">排序</th>
                        <th width="146" align="left">管理操作</th>
                    </tr>
                </thead>
                <tbody>
                    @foreach (CategoryAttrModel ca in Model.AttributeList)
                    {
                        <tr>
                            <td align="center"></td>
                            <td>@ca.AttrId</td>
                            <td>@ca.Name</td>
                            <td>@ca.AttrGroupName</td>
                            <td>
                                @{
                                    if (ca.ShowType.ToString() == "0")
                                    {
                                        @:文字
                                    }
                                    else
                                    {
                                        @:图片
                                    }
                                }
                            </td>
                            <td>
                                @{
                                    if (ca.Isfilter.ToString() == "0")
                                    {
                                        @:否
                                    }
                                    else
                                    {
                                        @:是
                                    }
                                }
                            </td>
                            <td>@ca.DisplayOrder</td>
                            <td>
                                @Html.ActionLink("[值列表]", "AttributeValueList", new { attrId = ca.AttrId }, new { @class = "editOperate" })|
                                @Html.ActionLink("[编辑]", "EditAttribute", new { attrId = ca.AttrId }, new { @class = "editOperate" })|
                                <a href="#" onclick="DelAttr(this,'@ca.AttrId')" class="deleteOperate">[删除]</a>
                              
                            </td>
                        </tr>
                    }
                </tbody>
            </table>
        </div>
    
    <div class="table_bottom"></div>

</body>
</html>